package com.lc.servlet;

import com.lc.bean.Role;
import com.lc.service.UsersService;
import com.lc.service.impl.UsersServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @description:查询角色列表，用于在add.jsp页面中显示
 * @author: ManolinCoder
 * @time: 2021/8/24
 */
@WebServlet("/power/user/getRoleList")
public class RoleListServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //调用查询角色列表的service方法
        UsersService usersService = new UsersServiceImpl();
        List<Role> roleList = usersService.getRoleList();
        req.setAttribute("roleList",roleList);
        req.getRequestDispatcher("add.jsp").forward(req,resp);
    }
}
